package com.java.bean;

import com.google.gson.Gson;
import com.java.util.JSONUtil;

import java.util.Objects;

public class Message {
    private int status;
    private String message;
    private Object data;

    public Message() {
    }

    public Message(int status) {
        this.status = status;
    }

    public Message(int status, String message) {
        this.status = status;
        this.message = message;
    }
    public Message(int status, Object data) {
        this.status = status;
        this.data = data;
    }

    public Message(int status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Message message1 = (Message) o;
        return status == message1.status && Objects.equals(message, message1.message) && Objects.equals(data, message1.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(status, message, data);
    }

    public String toJSON() {
        return JSONUtil.toJSON(this);
    }
}
